package com.hulk.ratel.manage.pass.route;


import com.hulk.ratel.common.constant.enums.EC;
import com.hulk.ratel.common.exception.ManageRteException;
import com.hulk.ratel.manage.cache.TxnCodeOrgClazzCahce;
import com.hulk.ratel.persistence.entity.TxncodeOrgClazz;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Optional;

/**
 * Created by hulk on 2017/10/30.
 * parent
 */
public abstract class BaseRoute {

    @Autowired
    protected TxnCodeOrgClazzCahce txnCodePayOrgClazzCahce;

    protected TxncodeOrgClazz getPayorgClazz(String orgCode, String txnCode) {
		TxncodeOrgClazz orgClazz = Optional.ofNullable(txnCodePayOrgClazzCahce.findTxnCodePayOrgClazz(orgCode, txnCode)).orElseThrow(() -> new ManageRteException( EC.E_200105));
        return orgClazz;

    }
}
